﻿using System;
using System.Collections.Generic;

namespace MetroGA.Core.Hits
{
	internal abstract class Hit
	{
		public DateTime CreationTime { get; set; }
		public string ApplicationId { get; set; }
		public string ApplicationName { get; set; }
		public string ApplicationVersion { get; set; }
		public string TrackingId { get; set; }
		public string ScreenResolution { get; set; }
		public string UserLanguage { get; set; }
		public string VisitorId { get; set; }
		public bool IsNewSession { get; set; }
		public int HitCount { get; set; }

		public virtual IEnumerable<KeyValuePair<string, string>> ToKeyValuePairs()
		{
			return new Dictionary<string, string>
				{
					{"v", "1"},
					/*"_v", typeof (Analytics).GetTypeInfo().Assembly.GetName().Version.ToString(3)},*/
					{"z", HitCount.ToString()},
					{"ul", UserLanguage},
					{"sr", ScreenResolution},
					{"an", ApplicationName},
					{"tid", TrackingId},
					{"aid", ApplicationId},
					{"av", ApplicationVersion},
					{"cid", VisitorId},
					{"qt", ((long) (DateTime.Now - CreationTime).TotalMilliseconds).ToString()}
				};
		}
	}
}